﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Net.Mime.MediaTypeNames;

namespace Program14
{
    public partial class Form1 : Form
    {
        public List<string> list = new List<string>();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string[] files = Directory.GetFiles(@"G:\Gitee\CsharpAdvanced\Program13\axb", ".");
            foreach (var item in files)
            {
                string fileName = Path.GetFileName(item);
                lbList.Items.Add(fileName);
                list.Add(item);
            }
        }

        private void lbList_SelectedIndexChanged(object sender, EventArgs e)
        {
            pbPhoto.Image = System.Drawing.Image.FromFile(list[lbList.SelectedIndex]);
        }
    }
}
